package day1;

/**
 * ClassName：Test2
 *
 * @Author：小鱼
 * @Create：2025-08-18 11:06
 */
public class Test2 {
    public static void main(String[] args)  {
        String userName = "briup";
        String password = "briup";
        try {
            login(userName, password);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private static void login(String userName, String password)throws Exception {
        if("briup".equals(userName)&&"123456".equals(password)){
            System.out.println("登录成功");
        }else {
            System.out.println("登录失败，用户名或密码有误！");
            //抛出异常
            throw new RuntimeException("登录失败异常");
            //
        }
    }
}
